void main() {
  //需求计算被勾选的商品的总价格
  //准备购物车数据
  List carts = [
    {"count": 2, "price": 10.0, "selected": true},
    {"count": 1, "price": 30.0, "selected": false},
    {"count": 5, "price": 20.0, "selected": true},
  ];
  //需求计算被勾选的商品的总价格
  //1．遍历购物车
  //2.判断商品是否被勾选
  //3.计算商品的总价
  //4.累加商品的总价
  double totalPrice = 0.0;
  for (var cart in carts) {
    if (cart["selected"]) {
      totalPrice += cart["count"] * cart["price"];
    }
  }

  print(totalPrice);
}
